/**
 * 
 */
package com.ncr.travel.appmgr.model;

import java.util.List;

import com.ncr.travel.appmgr.model.shared.RowSpecification;
import com.ncr.travel.appmgr.model.shared.TableDefinition;

/**
 * @author sn185078
 *
 */
public class TableDefinitionJson implements TableDefinition {

	int rowCount;
	int columnCount;
	List<RowSpecification> rowSpecification;

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.TableDefinition#getRowSpecification()
	 */
	@Override
	public List<RowSpecification> getRowSpecification() {
		return rowSpecification;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.TableDefinition#setRowSpecification(java.util.List)
	 */
	@Override
	public void setRowSpecification(List<RowSpecification> rowSpecification) {
		this.rowSpecification = rowSpecification;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.TableDefinition#getRowCount()
	 */
	@Override
	public int getRowCount() {
		return rowCount;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.TableDefinition#setRowCount(int)
	 */
	@Override
	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.TableDefinition#getColumnCount()
	 */
	@Override
	public int getColumnCount() {
		return columnCount;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.TableDefinition#setColumnCount(int)
	 */
	@Override
	public void setColumnCount(int columnCount) {
		this.columnCount = columnCount;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + columnCount;
		result = prime * result + rowCount;
		result = prime * result + ((rowSpecification == null) ? 0 : rowSpecification.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TableDefinitionJson other = (TableDefinitionJson) obj;
		if (columnCount != other.columnCount)
			return false;
		if (rowCount != other.rowCount)
			return false;
		if (rowSpecification == null) {
			if (other.rowSpecification != null)
				return false;
		} else if (!rowSpecification.equals(other.rowSpecification))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "TableDefinitionJson [rowCount=" + rowCount + ", columnCount=" + columnCount + ", rowSpecification=" + rowSpecification + "]";
	}

}
